<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>
    <style type="text/css">
        .btn{border-width:1px;}
    </style>
    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
                <!-- /section:settings.box -->
                <div class="page-content-area">
                    <div class="row">
                        <div class="col-xs-12">
                            <!-- PAGE CONTENT BEGINS -->

                            <!--/span-->
                            <!-- left menu ends -->



                            <form style="margin-bottom:10px;" class="form-inline" method="get" action="{:U('index')}">
                                <div class="form-group">
                                    <div class="input-group date" id="from-date-picker">
                                        <input name="star_time" type="text" class="form-control" value="" placeholder="开始日期">
                                        <span class="input-group-addon">
                                            <span class="fa fa-calendar"></span>
                                        </span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group date" id="to-date-picker">
                                        <input name="end_time" type="text" class="form-control" value="" placeholder="结束日期">
                                        <span class="input-group-addon">
                                            <span class="fa fa-calendar"></span>
                                        </span>
                                    </div>
                                </div>
                                <button type="submit" class="btn btn-primary">查询</button>
                                
                                <span class="text-muted" style="display: inline-block; vertical-align: bottom; margin-left: 10px">
                                    支付金额: ¥{$total_money},
                                    支付笔数: {$count_order}    </span>

                                <!--<button type="button" class="btn btn-primary pull-right" id="btn-export"><i class="fa fa-download"></i> 导出已支付订单</button>-->
                            </form>

                            <nav>
                                <form class="form-inline search-form" method="get" action="{:U('index')}">
                                    <div class="input-group pull-right">
                                        <input type="text" name="q" value="" placeholder="商户单号, 微信交易号">
                                        <span class="input-group-btn">
                                            <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
                                        </span>
                                    </div>
                                </form>
                                <ul class="nav nav-tabs pull-left">
                                    <li <if condition="$status eq -1"> class="active" </if>><a href="{:U('index')}">全部</a></li>
                                    <li <if condition="$status eq 0"> class="active" </if>><a href="{:U('index' , ['status' => 0] )}">待支付</a> </li>
                                    <li <if condition="$status eq 1"> class="active" </if>><a href="{:U('index' , ['status' => 1] )}">已支付</a></li>

                                </ul>
                            </nav>

                            <table class="table table-striped table-bordered table-hover responsive">
                                <thead>
                                    <tr>
                                        <td>商户单号</td>
                                        <td>订单类型</td>
                                        <td>用户</td>
                                        <td class="text-right">总额</td>
                                        <td class="text-center">订单状态</td>
                                        <td class="text-center">创建日期</td>
                                        <td>代理</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    <volist name="data.list" id="vo" empty="$empty">
                                    <tr>
                                        <td>{$vo.orderid}</td>
                                        <td>
                                        <if condition="$vo['money'] eq 180 or $vo['money'] eq 365">
                                            VIP充值
                                            <else/>
                                            普通充值
                                        </if>
                                        </td>
                                        <td>
                                            <span class="member-info">
                                                <img style="width:18px;margin-right:5px" src="{$vo.head_portrait|default='/Public/attached/avatar2.png'}">
                                                <a href="#"><span>{$vo.username}</span> <span>({$vo.uid})</span></a>
                                                    
                                            </span>
                                        </td>
                                        <td class="text-right">¥ <span class="order-amount">{$vo.money}</span></td>
                                        <td class="text-center">
                                            <if condition="$vo['status'] eq 1">
                                                <span class="btn btn-xs btn-paid">已支付</span>
                                            <else/>
                                                <span class="btn btn-xs btn-pending">待支付</span>
                                            </if>
                                        </td>
                                        <td class="text-center">{$vo.response_time|date='Y-m-d H:i:s' , ###}</td>
                                        <td>
                                            <if condition="$vo['user']">
                                                {$vo.user}
                                            <else/>
                                                无
                                            </if>
                                        </td>
                                        
                                    </tr>
                                    </volist>
                                </tbody>
                            </table>
                            {$data.page}
                            <!-- PAGE CONTENT ENDS -->
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.page-content-area -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>
</div><!-- /.main-container -->
<include file="Public/footerjs"/>
<script src="__PUBLIC__/qwadmin/js/date-time/bootstrap-datepicker.js"></script>

<script type="text/javascript">
    $(function () {
        $(".btn-add").on("click", function () {
            layer.prompt({formType: 0, title: '请输入提现金额'}, function (value, index, element) {
                $.post("{:U('Withdraw/hundle')}", {amount: value}, function (data) {
                    if (data.status == 1) {
                        layer.alert(data.msg, function () {
                            window.location.reload();
                        });
                    } else {
                        layer.alert(data.msg);
                    }
                })
            });
        });
        var start_date = "";
        var end_date = "";
        $('#from-date-picker').datepicker({
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            todayBtn: 'linked',
            language: 'cn',
            endDate : $("#to-date-picker").find("input").val()
        }).on("changeDate" , function(ev){
            start_date = $(this).find("input").val();
            if(end_date != "" && start_date> end_date){
                layer.alert("超始日期超过结束日期" , function(){
                    $('#from-date-picker').find("input").val('');
                    layer.close(1);
                })
            }
        });
        $('#to-date-picker').datepicker({
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            todayBtn: 'linked',
            language: 'cn',
            startDate : $('#from-date-picker').find("input").val()
        }).on("changeDate" , function(ev){
            end_date = $(this).find("input").val();
            if(end_date < start_date){
                layer.alert("结束日期超过起始日期" , function(index){
                    $('#to-date-picker').find("input").val('');
                    layer.close(1);
                })
            }
        });
    });
</script>
</body>
</html>